import instance from "@/utils/request";

// 获取天气数据
export function getWeather() {
    return instance({
        url: "https://restapi.amap.com/v3/weather/weatherInfo?parameters&key=bb2e07008e49543fa3edd6b4ea2fea56&city=310115",
        method: "GET",
    });
}

// 每日一言
export function getPoetry() {
    return instance({
        url: "https://www.meiriyiyan.com/api/v1/",
        method: "GET",
    });
}


// 获取音乐数据
export function getMusicData() {
    return instance({
        url: "/getMusic",
        method: "GET",
    });
}

// 登录
export function login(password: string) {
    return instance({
        url: "/login",
        method: "POST",
        data: {password},
    });
}


// 账号验证
export function getVerification(token: string) {
    return instance({
        url: "/verification",
        method: "POST",
        data: {token},
    });
}

//  获取flex数据
export function getFlexList() {
    return instance({
        url: `/flexList`,
        method: "GET",
    });
}

//  获取瀑布流资源数据
export function getWaterfallList(data: object) {
    return instance({
        url: `/resourceList`,
        method: "POST",
        data
    });
}

//  获取轮播图数据
export function getSlidesList() {
    return instance({
        url: `/slides/list`,
        method: "GET",
    });
}

//  获取AccessToken
export function getAccessToken() {
    return instance({
        url: `https://aip.baidubce.com/oauth/2.0/token`,
        method: "POST",
        params: {
            grant_type: "client_credentials",
            client_id: "0eXiWR0mrnoKtiibImhsye5a",
            client_secret: "6QEPetw8qTWJWK2dV7WxdJljagnzMhme"
        }
    });
}

export function getChat(data: object) {
    return instance({
        url: `rpc/2.0/ai_custom/v1/wenxinworkshop/chat/yi_34b_chat`,
        method: "POST",
        headers: {
            "Content-Type": "text/event-stream",
        },
        data,
        params: {
            access_token: "24.0cf14a955a20456921dedd1cba3a9826.2592000.1719479853.282335-75794370",
        }
    });
}
